#pragma once
#include <string>
#include "connection_handler.h"
class Service;
class Connection;
class DBConnectionHandler;
class DBConnection : public ConnectionHandler
{
public:
	DBConnection(Service* service, const std::string& host, int port);
	~DBConnection(void);
	void setHandler(DBConnectionHandler* handler);
	void sendData(void* data, int len);
public:
	virtual void onConnected(Connection* conn);
	virtual void onClose(Connection* conn);
	virtual void onData(Connection* conn);
	
private:
	DBConnectionHandler* m_handler;
	Connection* m_conn;
	Service* m_service;
	std::string m_host;
	int m_port;
};
